#ifndef T_CASEINFORMATION_H
#define T_CASEINFORMATION_H

#include "ElaText.h"
#include "T_BasePage.h"
#include "expandablecard.h"
#include "ElaPlainTextEdit.h"
#include "ElaLineEdit.h"
#include <QVideoWidget>
#include <QMediaPlayer>
#include <QSlider>
#include <QTextEdit>
#include <qcoreevent.h>

class ElaToggleSwitch;
class ElaLCDNumber;
class T_CaseInformation:public T_BasePage
{
    Q_OBJECT
public:
    Q_INVOKABLE explicit T_CaseInformation(QWidget* parent = nullptr);
    ~T_CaseInformation();


protected:
    bool eventFilter(QObject *obj, QEvent *event) override {
        if (obj == dateTag && event->type() == QEvent::MouseButtonDblClick) {
            // 进入编辑模式
            datestartEditing();
            return true;
        } else if(obj == anamnesisTag && event->type() == QEvent::MouseButtonDblClick)
        {
            anamnesisstartEditing();
            return true;
        }
        else if(obj == diagnosisTag && event->type() == QEvent::MouseButtonDblClick)
        {
            diagnosisstartEditing();
            return true;
        }
        else if(obj == bodycheckTag && event->type() == QEvent::MouseButtonDblClick)
        {
            bodycheckstartEditing();
            return true;
        }
        else if(obj == complaintTag && event->type() == QEvent::MouseButtonDblClick)
        {
            complaintstartEditing();
            return true;
        }
        else if(obj == presenthistoryTag && event->type() == QEvent::MouseButtonDblClick)
        {
            presenthistorystartEditing();
            return true;
        }
        return QWidget::eventFilter(obj, event);
    }

private:
    ElaToggleSwitch* _toggleSwitch{nullptr};
    ElaLCDNumber *_lcdNumber{nullptr};
   /* ElaText *test = new ElaText("test");
    ElaLineEdit *testEdit = new ElaLineEdit(this);*/
    ElaText *dateTag = new ElaText("入院日期:");
    ElaText *diagnosisTag = new ElaText("入院诊断:");
    ElaText *bodycheckTag = new ElaText("入院查体:");
    ElaText *complaintTag = new ElaText("主诉:");
    ElaText *presenthistoryTag = new ElaText("现病史:");
    ElaText *anamnesisTag = new ElaText("既往史:");

    ElaLineEdit *dateEdit = new ElaLineEdit(this);
    ElaLineEdit *diagnosisEdit = new ElaLineEdit(this);
    ElaLineEdit *bodycheckEdit = new ElaLineEdit(this);
    ElaLineEdit *complaintEdit = new ElaLineEdit(this);
    ElaLineEdit *presenthistoryEdit = new ElaLineEdit(this);
    ElaLineEdit *anamnesisEdit = new ElaLineEdit(this);

    int cardNumber = 0;
    bool cardinformationColor = 0;
    QVector<ExpandableCard*> cardVector;

    QString _name;
    QString _age;
    QString _gender;
    QString _zone;
    QString _Id;
    QString _date;
    QString _diagnosis;
    QString _bodycheck;
    QString _complaint;
    QString _presenthistory;
    QString _anamnesis;
    QVector<QString> _timeVec;
    QVector<QString> _contentVec;

    QString _importedName;
    QString _importedId;

    void createLocalFiles();
    //void refreshUI();


private slots:
    void datestartEditing();
    void diagnosisstartEditing();
    void bodycheckstartEditing();
    void complaintstartEditing();
    void presenthistorystartEditing();
    void anamnesisstartEditing();


    void datefinishEditing();
    void diagnosisfinishEditing();
    void bodycheckfinishEditing();
    void complaintfinishEditing();
    void presenthistoryfinishEditing();
    void anamnesisfinishEditing();

    void onImportClicked();
    void onSaveClicked();
Q_SIGNALS:

};

#endif // T_CASEINFORMATION_H
